<?php

/**
 * This file is part of TobbiVM-Analyser.
 *
 * TobbiVMShop is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * TobbiVMShop is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with TobbiVMShop.  If not, see <http://www.gnu.org/licenses/>.
 */
/**
 * Create and output the page
 *
 * @author Norbert Gebert
 * @version    $Id$
 * @package    TobbiVM-Analyser
 * @copyright  Copyright (C) 2014
 * @author     Norbert Gebert
 * @license    GPL3
 */
ini_set('session.use_only_cookies', '1');
ini_set('session.use_trans_sid', '0');
define('TOBBIVM', 1);
// Start Session
session_start();
require_once('config.php');
date_default_timezone_set(PHP_TIMEZONE);

// Setting Language
// Translate-File must be in ./language/$language/LC_MESSAGES/main.mo
// Make sure that the SID has been assigned by the server
// to make a possible session fixation attack ineffective
// putenv('LANG=' . LANGUAGE);
setlocale(LC_ALL, LANGUAGE);
// Path to Language-Files
bindtextdomain('main', './language');
// setting Domain
textdomain('main');
bind_textdomain_codeset('main', 'UTF-8');
// Translate-File must be in ./language/$language/LC_MESSAGES/main.mo


include_once('module/class/validate.class.php');
$validate = new validate;

// load Templateengine
include_once('module/quickskin/_lib/class.quickskin.php');

// load Messageengine
include_once('module/class/message.class.php');
$message = new message();

// Init Connection to Database
include_once 'module/database/db.class.php';
$db = new ezSQL_mysql(DB_USER,
		DB_PASSWORD,
		DB_NAME,
		DB_HOST);
db::getInstance()->query("SET NAMES 'utf8'");

// setting Domain
textdomain("main");

// Call Startpage
$page = new QuickSkin('index.tpl.php');
include_once('module/core.php');

// Config the Templateengine
$page->set('template_dir', TEMPLATE_PATH . '/');
$page->set('temp_dir', 'tmp/');
$page->set('cache_dir', 'tmp/');
$page->set('cache_lifetime', 1);
// Image-Path
$page->assign('tpl_img', TEMPLATE_PATH . '/images/');
$page->assign('url_img', URL . '/' . TEMPLATE_PATH . '/images/');
// Template Javascript-Path
$page->assign('tpl_js', TEMPLATE_PATH . '/js/');
$page->assign('url_js', URL . '/' . TEMPLATE_PATH . '/js/');
// Template CSS-Path
$page->assign('tpl_css', TEMPLATE_PATH . '/css/');
$page->assign('url_css', URL . '/' . TEMPLATE_PATH . '/css/');

$page->output();
?>